#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>

std::string toFixed(double value, int decimals) {
    double multiplier = std::pow(10.0, decimals);
    double rounded = std::round(value * multiplier) / multiplier;
    
    std::ostringstream oss;
    oss << std::fixed << std::setprecision(decimals) << rounded;
    return oss.str();
}

int main() {
    double expected = 0.07499999999999998;  // 银行家舍入应该选择的值
    double actual = 6.0/80;
    
    std::cout << std::fixed << std::setprecision(17);
    std::cout << "理论上应该是: " << expected << std::endl;
    std::cout << "实际计算结果: " << actual << std::endl;
    std::cout << "相等? " << (actual == expected) << std::endl;
    
    if (actual == expected) {
        std::cout << "\n如果相等，toFixed(2)应该是: " << toFixed(actual, 2) << std::endl;
        std::cout << "因为 " << actual << " < 0.075" << std::endl;
        std::cout << "所以应该得到 '0.07' 而不是 '0.08'" << std::endl;
    }
    
    return 0;
}

